
let str1 = [`<img src='face08' /><color=#00ff00> 点击右下方按钮，开始闯关吧~ </c>`];
let str2 = [
    `<color=#00ff00> 小龚子开开心心的来到神奇的蛋糕世界！~~ </c><img src='face07' />`,
    `<color=#00ff00> 正当她想大吃一顿的时候发现，这里的蛋糕吃一个就会增加体重!</c><img src='face06' />`,
    `<color=#00ff00> 当自己体重太重时，就会掉下去，5555，吃不吃呢，小龚子很犹豫到底要不要吃呢? </c><img src='face17' />`,
    `<color=#00ff00> 蛋糕+2，甜甜圈+1，棒棒糖+1，当体重大于2时就会失败！ </c><img src='face12' />`,
    `<color=#00ff00> ps：偶尔会飞上来自己最爱的咸菜，吃了体重就会减少一点哦！ </c><img src='face20' />`,
    `<color=#00ff00> 当收集的分数超过100分时就会开启下一个神奇的世界！ </c><img src='face16' />`,
    `<color=#00ff00> 时间限制60s，加油吧！ </c><img src='face01' />`,
];
let str3 = [
    `<color=#00ff00> 跳啊~!跳啊~  跳</c><img src='face07' />`,
    `<color=#00ff00> 小吴子偷了你的咸菜嘎达跑走啦~ </c><img src='face19' />`,
    `<color=#00ff00> 追上去打到他,进度条满了就可以获取胜利啦！ </c><img src='face14' />`,
    `<color=#00ff00> 掉下去就失败！！ </c><img src='face10' />`
];
let str4 = [`<img src='face08' /><color=#00ff00> 哈哈，猜到你拼不起来~，算啦，这次当你过关了~ </c>`];
let str5 = [`<color=#00ff00> 点击下一步，可以看到我送给你的祝福哦~~ps：纯手绘 </c><img src='face03' />`];
let str6 = [`<img src='face21' /><color=#00ff00> 在上方输入框内输入之前获取到的密码，点击按钮即即可去挑选宝藏哦~ </c>`];


cc.Class({
    extends: cc.Component,

    properties: {
        richText : cc.RichText,
        bg : cc.Node,
        gameNode : cc.Node
    },

    // use this for initialization
    onLoad: function () {
        this.count = 0;
        let str = "";
        switch(DialogStr){
            case 1 : 
                str = str1;
                break;
            case 2 : 
                str = str2;
                break;
            case 3 : 
                str = str3;
                break;
            case 4 : 
                str = str4;
                break;
            case 5 : 
                str = str5;
                break;
            case 6 : 
                str = str6;
                break;
        }
        this.richText.string = str[0];
        this.node.on("touchstart", ()=>{
            event.stopPropagation();
            this.count++;
            if(this.count >= str.length){
                cc.log("领奖");
                this.node.active = false;
                if(this.gameNode && this.gameNode.getComponent('Game')){
                    this.gameNode.getComponent('Game').getAward();
                }
                if(this.gameNode && this.gameNode.getComponent('Main')){
                    this.gameNode.getComponent('Main').closeDialog();
                }
            }
            else{
                this.richText.string = str[ this.count];
            }
        });
    },


    // called every frame, uncomment this function to activate update callback
    // update: function (dt) {

    // },
});
